package com.youlai.boot.system.model.entity;

import com.mybatisflex.annotation.Column;
import com.mybatisflex.annotation.Id;
import com.mybatisflex.annotation.KeyType;
import com.mybatisflex.annotation.Table;
import com.youlai.boot.common.listener.CreatedByListenerFlag;
import com.youlai.boot.common.listener.UpdatedByListenerFlag;
import lombok.Getter;
import lombok.Setter;
import lombok.experimental.Accessors;

import java.util.Date;

/**
 * 部门实体
 *
 * @author Ray
 * @since 2024/06/23
 */

@Getter
@Setter
@Accessors(chain = true)
@Table(value = "sys_dept")
public class SysDeptEntity implements CreatedByListenerFlag, UpdatedByListenerFlag {
    /**
     * 主键ID
     */
    @Id(keyType = KeyType.Auto)
    private Long id;

    /**
     * 部门名称
     */
    @Column(value = "name")
    private String name;

    /**
     * 部门编码
     */
    @Column(value = "code")
    private String code;

    /**
     * 父节点id
     */
    @Column(value = "parent_id")
    private Long parentId;

    /**
     * 父节点id路径
     */
    @Column(value = "tree_path")
    private String treePath;

    /**
     * 显示顺序
     */
    @Column(value = "sort")
    private Integer sort;

    /**
     * 状态(1-正常 0-禁用)
     */
    @Column(value = "status")
    private Integer status;

    /**
     * 创建人ID
     */
    @Column(value = "create_by")
    private Long createBy;

    /**
     * 更新人ID
     */
    @Column(value = "update_by")
    private Long updateBy;

    /**
     * 逻辑删除
     */
    @Column(value = "is_deleted", isLogicDelete = true)
    private Integer isDeleted;

    /**
     * 创建时间
     */
    @Column(value = "create_time", onInsertValue = "now()")
    private Date createTime;

    /**
     * 更新时间
     */
    @Column(value = "update_time", onInsertValue = "now()", onUpdateValue = "now()")
    private Date updateTime;
}